package com.mewp.permissions.system.service.impl;

import com.mewp.permissions.model.po.SysLoginLog;
import com.mewp.permissions.system.mapper.SysLoginLogMapper;
import com.mewp.permissions.system.service.AsyncLoginLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author mewp
 * @version 1.0
 * @date 2023/8/5 17:41
 */
@Service
public class AsyncLoginLogServiceImpl implements AsyncLoginLogService {
    @Resource
    private SysLoginLogMapper loginLogMapper;

    @Override
    public void recordLoginLog(String username, Integer status, String ipaddr, String message) {
        SysLoginLog sysLoginLog = new SysLoginLog();
        sysLoginLog.setUsername(username);
        sysLoginLog.setIpaddr(ipaddr);
        sysLoginLog.setMsg(message);
        // 日志状态
        sysLoginLog.setStatus(status);
        loginLogMapper.insert(sysLoginLog);
    }
}
